/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



package bsc.war.form;


import bsc.ejb.metadata.Alert;
import bsc.war.delegate.DelegateBSC;
import bsc.war.factory.Factory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.math.NumberUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 *
 * @author luisZavaleta
 */
public class SelectAlert extends AbstractController{

     @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
             HttpServletResponse response) throws Exception {
             DelegateBSC delegate = (DelegateBSC) Factory.getBean("DelegateBSC");

         ModelAndView mav = new ModelAndView();
         try {
             Alert alert = null;
             if (NumberUtils.isDigits(request.getParameter("alertId"))) {
                 alert = delegate.findAlert(Long.valueOf(request.getParameter("alertId")));
             }
             mav.addObject("alert", alert);
         } catch (Exception e) {
         }

         return mav;
    }

}
